package com.lbt.javaSE.meituan;

import java.util.*;

public class Main5{
    public static class Node implements Comparable<Node>{
        int number; //排序位置
        int value1; //重要程度
        int value2; //优先级

        public int getNumber() {
            return number;
        }

        public void setNumber(int number) {
            this.number = number;
        }

        public int getValue1() {
            return value1;
        }

        public void setValue1(int value1) {
            this.value1 = value1;
        }

        public int getValue2() {
            return value2;
        }

        public void setValue2(int value2) {
            this.value2 = value2;
        }

        public Node(int value1, int value2) {
            this.value1 = value1;
            this.value2 = value2;
        }

        @Override
        public int hashCode() {
            return Objects.hash(value1, value2);
        }

        @Override
        public String toString() {
            return "Node{" +
                    "编号_：number=" + (number+1) +
                    ", 重要程度_：value1=" + value1 +
                    ", 优先级_:value2=" + value2 +
                    '}';
        }

        public Node(int number, int value1, int value2) {
            this.number = number;
            this.value1 = value1;
            this.value2 = value2;
        }

        @Override
        public int compareTo(Node o) {
            if(this.value1>o.value1){
                return -1;
            }else if (this.value1==o.value1&&this.value2>o.value2){
                return -1;
            }else if (this.value1==o.value1&&this.value2==o.value2){
                return 0;
            }
            return 1;
        }
    }
    public static void main(String[] args) {

        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        List<Node> list=new LinkedList<>();

        int v1, v2;
        for (int i = 0; i < n; i++) {
            v1 = sc.nextInt();  //重要程度
            v2 = sc.nextInt();  //优先级
            list.add(new Node(i,v1,v2));
        }
        int[] count=new int[n+1];
        for(int i=1;i<count.length;i++){
            count[i]=i;
        }
         Collections.sort(list);
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i).toString());
        }
    }
}
